package design_pattern.adapter.demo02.foreign;

import design_pattern.adapter.demo02.Player;

/**
 * @version 1.0.0
 * Created by cyd on 2022-06-06 10:43:59
 * @ClassName : design_pattern.adapter.demo02.foreign.Translator
 * @Description : 翻译类，这里的翻译是个适配器(代理)，真正执行动作的是外籍球员
 */
public class Translator extends Player {

    private ForeignCenter foreignCenter;

    public Translator(String name) {
        super(name);
    }

    public ForeignCenter getForeignCenter() {
        return foreignCenter;
    }

    public void setForeignCenter(ForeignCenter foreignCenter) {
        this.foreignCenter = foreignCenter;
    }

    @Override
    public void attack() {
        // 翻译是个代理，真正执行动作的是外籍球员
        foreignCenter.进攻();
    }

    @Override
    public void defence() {
        // 翻译是个代理，真正执行动作的是外籍球员
        foreignCenter.防守();
    }
}
